import { reactive, ref } from "vue";
import axios from "axios";
const url = import.meta.env.VITE_backurl

export const getLogList = (data) => {
  return axios({
    method: 'get',
    url: url + '/sys/getLogList',
    params: {
      page: data.page,
      limit: data.limit,
      time: data.time,
    }
  })
}

export const getLogCount = () => {
  return axios({
    method: 'get',
    url: url + '/sys/getLogCount',
  })
}

export const subSetting = (data) => {
  return axios({
    method: 'post',
    url: url + '/wz/subSetting',
    data: data
  })
}

// 用户的增删改查
export const getUserList = () => {
  return axios({
    method: 'get',
    url: url + '/sys/getUserList',
  })
}

export const updateUser = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/updateUser',
    data
  })
}

export const addUser = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/addUser',
    data
  })
}

export const delUser = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/delUser',
    data
  })
}

// 角色的增删改查
export const getRoleList = () => {
  return axios({
    method: 'get',
    url: url + '/sys/getRoleList',
  })
}

export const addRole = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/addRole',
    data
  })
}

export const delRole = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/delRole',
    data
  })
}

export const updateRole = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/updateRole',
    data
  })
}

// 权限的增删改查
export const getRightList = () => {
  return axios({
    method: 'get',
    url: url + '/sys/getRightList',
  })
}

export const addRight = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/addRight',
    data
  })
}

export const delRight = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/delRight',
    data
  })
}

export const updateRight = (data) => {
  return axios({
    method: 'post',
    url: url + '/sys/updateRight',
    data
  })
}
